﻿using Microsoft.Xna.Framework;

namespace Engine.Math
{
    public static class BoundingBoxEx
    {
        static public BoundingBox Transform(this BoundingBox boundingBox, Matrix worldMatrix)
        {
            Vector3[] verts = boundingBox.GetCorners();
            Vector3[] destinations = new Vector3[verts.Length];
            Vector3.Transform(verts, ref worldMatrix, destinations);
            
            BoundingBox transformedBoundingBox = BoundingBox.CreateFromPoints(destinations);
            return transformedBoundingBox; 
        }
    }
}
